$(function () {
	requestAjax({
		url: '/project/province/count',
		async: false,
		type: 'GET',
		success: function success(data) {
			//console.log(data);
			if (data) {
				var mapName = 'china';
				var mapData = data;
				var geoCoordMap = {};
				var toolTipData = [];
				console.log(mapData)

				option = {
					tooltip: {
						show: true,
						formatter: function formatter(params,xms) {
							//return params.name + '省:' + params.data['value'] + '个';
							//return params.name + params.data['xms'] + '个';
							return params.name;
						}
					},
					visualMap: {
						show: false,
						pieces: [{
							value: 0,
							color: "#5db8ed"
						}, {
							value: 1,
							color: "#cb2424"
						}, {
							value: 2,
							color: "#6eb92b"
						}, {
							value: 3,
							color: "#f8bb46"
						}]
					},
					geo: {
						show: true,
						map: mapName,
						label: {
							normal: {
								show: false
							},
							emphasis: {
								show: false
							}
						},
						roam: false,
						itemStyle: {
							normal: {
								areaColor: '#d8d8d8',
								borderColor: '#fff'
							},
							emphasis: {
								areaColor: '',
								shadowBlur: 10,
				                shadowOffsetX: 0,
							}
						}
					},
					series: [{
						type: 'map',
						map: mapName,
						geoIndex: 0,
						aspectScale: 0.75, //闀垮姣�
						showLegendSymbol: false, // 瀛樺湪legend鏃舵樉绀�
						label: {
							normal: {
								show: true
							},
							emphasis: {
								show: false,
								textStyle: {
									color: '#000'
								}
							}
						},
						roam: true,
						itemStyle: {
							normal: {
								areaColor: '#fff',
								borderColor: '#eee'
							},
							emphasis: {
								areaColor: '#eee'
							}
						},
						animation: false,
						data: [
							{name: "北京", value: 1,xms:'10'},
							{value: 1, name: "天津"},
							{name: "河北", value: 1},
							{name: "山西", value: 1},
							{name: "内蒙古", value: 1},
							{value: 1, name: "辽宁"},
							{name: "吉林", value: 1},
							{name: "黑龙江", value: 1},
							{value: 3, name: "上海"},
							{name: "江苏", value: 3},
							{name: "浙江", value: 3},
							{name: "安徽", value: 3},
							{value: 2, name: "福建"},
							{name: "江西", value: 3},
							{name: "山东", value: 3},
							{name: "河南", value: 3},
							{name: "湖北", value: 3},
							{name: "湖南", value: 3},
							{value: 2, name: "广东"},
							{name: "广西", value: 2},
							{name: "海南", value: 2},
							{name: "重庆", value: 0},
							{name: "四川", value: 0},
							{name: "贵州", value: 0},
							{name: "云南", value: 0},
							{name: "西藏", value: 0},
							{name: "陕西", value: 0},
							{name: "甘肃", value: 0},
							{value: 0, name: "青海"},
							{name: "宁夏", value: 0},
							{name: "新疆", value: 0},
							{name: "台湾", value: 2},
							{name: "香港", value: 0},
							{name: "澳门", value: 0}
						]
					}]
				};

				//鍒濆鍖杄charts瀹炰緥
				var myChart = echarts.init(document.getElementById('main'));
				//浣跨敤鍒跺畾鐨勯厤缃」鍜屾暟鎹樉绀哄浘琛�
				myChart.setOption(option);

				myChart.on('click', function (params) {
					var name = params.name;
					var value = params.value;
					if (name && value > 0) {
						requestAjax({
							url: '/trace/click',
							async: false,
							type: 'POST',
							data: {
								source: "PC",
								traceId: '5',
								traceName: '棣栭〉|缃戠粶鍒嗗竷涓殑鐐箌椤圭洰鍒楄〃鐨勬祻瑙堥噺',
								contentName: name
							},
							success: function success(data) {
								name = encodeURI(name);
								window.location.href = "/pages/investment/investment.html?projectName=" + name;
							}
						});
					}
				});
			}
		}
	});
});